#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>

#include <sys/shm.h>

#include <stdio.h>
#include <fcntl.h>

int main()
{
	key_t key_sem_common  = ftok( ".for_keys", 1);
	
 	int sem_id_common  = semget( key_sem_common,1, NULL);

	while ( 1 )	
	{		
		int val;
		
		val = semctl( sem_id_common , 0,GETVAL);
		printf("IN = %d\t",val);
		
		val = semctl( sem_id_common, 1,GETVAL);
		printf("OUT = %d\t",val);
		
		val = semctl( sem_id_common , 2,GETVAL);
		printf("Empty = %d\t",val);
		
		val = semctl( sem_id_common, 3,GETVAL);
		printf("Full = %d\n",val);
		
		perror("asdas");
		
		sleep(1);
	}
	return 0;
}